/**
 * @file base_handler.h
 * @author 王烨
 * @date 2011-01-09
**/
#ifndef BASE_HANDLER_H_INCLUDED
#define BASE_HANDLER_H_INCLUDED

#include <string>
#include <vector>
#include <hash_map>

#include <google/protobuf/message.h>
#include <google/protobuf/service.h>
#include <google/protobuf/stubs/common.h>

class BaseHandler
{
public:
  BaseHandler(std::vector<google::protobuf::Service*> services);
  BaseHandler(google::protobuf::Service *services[], int count);
  virtual ~BaseHandler(){}
protected:
  void DeserializeRequest(const std::string requestData,
  void CallMethod(const std::string &serviceName,
		  const std::string &methodName,
		  ServerController &controller,
		  const google::protobuf::Message *parameter,
		  google::protobuf::Message *result,
		  Closure *done);
private:
  std::hash_map<string, google::protobuf::Service*> services;
};

#endif
